package com.kgc.invitation.invitationmanagerweb.controller;

import com.kgc.invitation.service.InviService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class InviController {

    @Reference
    InviService inviService;
    @RequestMapping("/seleInvi")
    public String seleInvi(@RequestParam(value = "title",required = false,defaultValue = "")String title,
                           @RequestParam(value = "pageNum",required = false,defaultValue = "1")Integer pageNum){
        String allByTitle = inviService.getAllByTitle(title, pageNum);
        return allByTitle;
    }

    @RequestMapping("/deleInvi")
    public String deleInvi(Integer id){
        Integer integer = inviService.deleInvi(id);
        if(integer>0){
            return "SUCCESS";
        }else{
            return "FAIL";
        }
    }
}
